﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace EXOWorld.Service
{
    public class UserAccountService
    {
        private EXOWorld.Data.CustomerCRUD customerCRUD;
        private EXOWorld.Data.RoomCRUD roomCRUD;
        private EXOWorld.Data.LoginCRUD loginCRUD;

        public Cust getCustomerInfo(string customerID)
        {
            Cust customerData = customerCRUD.getCustomerbyID(customerID);
            return customerData;
        }

        public void createNewCustomer(Cust newCustomer)
        {
            Cust tempCust = customerCRUD.createCustomer(newCustomer);
            if (tempCust != null)
                Console.WriteLine("Created Successfully");
            else Console.WriteLine("Create Failed");
        }

        public void updateCustomerInfo(Cust updCustomer)
        {
            Cust tempCust = customerCRUD.updateCustomer(updCustomer);
            if (tempCust != null)
                Console.WriteLine("Updated Successfully");
            else Console.WriteLine("Update Failed");
        }

        public void deleteCustomerInfo(string custID)
        {
            if (customerCRUD.deleteCustomer(custID))
                Console.WriteLine("Deleted Successfully");
            else Console.WriteLine("Delete Failed");
        }

        public Room getRoomInfo(string roomID)
        {
            Room roomData = roomCRUD.getRoombyID(roomID);
            return roomData;
        }

        public void createNewRoom(Room newRoom)
        {
            Room tempRoom = roomCRUD.createRoom(newRoom);
            if (tempRoom != null)
                Console.WriteLine("Created Successfully");
            else Console.WriteLine("Create Failed");
        }

        public List<Room> getRoomsbyType(string Type)
        {
            List<Room> roomsList = roomCRUD.getRoomsbyType(Type);
            return roomsList;
        }


        public void updateRoomInfo(Room updRoom)
        {
            Room tempRoom = roomCRUD.updateRoom(updRoom);
            if (tempRoom != null)
                Console.WriteLine("Updated Successfully");
            else Console.WriteLine("Update Failed");
        }

        public void deleteRoomInfo(string roomID)
        {
            if (roomCRUD.deleteRoom(roomID))
                Console.WriteLine("Deleted Successfully");
            else Console.WriteLine("Delete Failed");
        }

        public Login getLoginInfo(string userID)
        {
            Login loginData = loginCRUD.getUserbyID(userID);
            return loginData;
        }

        public void createNewUser(Login newUser)
        {
            Login tempUser = loginCRUD.createUser(newUser);
            if (tempUser != null)
                Console.WriteLine("Created Successfully");
            else Console.WriteLine("Create Failed");
        }

        public void updateUserInfo(Login updUser)
        {
            Login tempUser = loginCRUD.updateUser(updUser);
            if (tempUser != null)
                Console.WriteLine("Updated Successfully");
            else Console.WriteLine("Update Failed");
        }

        public void deleteUserInfo(string userID)
        {
            if (loginCRUD.deleteUser(userID))
                Console.WriteLine("Deleted Successfully");
            else Console.WriteLine("Delete Failed");
        }

        public List<Login> getAllUserDetails()
        {
            return loginCRUD.getAllUsers();
        }

    }
}